<template>
  <div class="detail">
    <!-- <HmHeader showArrow @clickLeft="$router.go(-1)">
      <template>面经详情</template>
      <template #right>搜索</template>
    </HmHeader> -->
    <van-nav-bar title="面经详细" left-text="返回" @click-left="onClickLeft" />
    <h1>{{ item.stem }}</h1>
    <div class="info">
      <span>{{ item.createdAt }}</span>
      <span>|</span>
      <span>{{ item.views }} 浏览量</span>
      <span>|</span>
      <span>{{ item.likeCount }} 点赞数</span>
    </div>

    <div class="qian">
      <img :src="item.creatorAvatar" alt="" />
      <span>{{ item.creatorName }}</span>
    </div>

    <div class="content">
      {{ item.content }}
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "HmDetail",

  created() {
    this.getData(this.$route.query.id);
  },
  data() {
    return {
      item: {},
    };
  },
  methods: {
    async getData(id) {
      if (!id) {
        return;
      }
      const res = await axios.get(
        "https://mock.boxuegu.com/mock/3083/articles/" + id
      );
      this.item = res.data.result;
    },
    onClickLeft() {
      this.$router.go(-1);
    },
    fn() {
      console.log("点击了");
    },
  },
};
</script>

<style lang="less" scoped>
.qian {
  display: flex;
  align-items: center;

  img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}

.content {
  text-indent: 2em;
}

.nav-bar-text-color {
  color: #febf67;
}
</style>
